package leetcode;

/**
 * @ author : HyoJoo-W
 * @ createDate : 2021-06-03 22:48
 * @ Description :
 */
public class Palindrome
{
    public static void main(String[] args)
    {
        System.out.println(isPalindrome(11));
    }

    //是否为回文数
    public static boolean isPalindrome(int x)
    {
        String num = Integer.toString(x);

        int head = 0;
        int tail = num.length() - 1;


        while (head < tail)
        {
            char headCh = num.charAt(head++);
            char tailCh = num.charAt(tail--);
            if (headCh != tailCh)
            {
                return false;
            }
        }
        return true;

    }
}
